﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WinMenu
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            CreateMyMainMenu();
        }
        public void CreateMyMainMenu()
        {
            // Create an empty MainMenu.
            MainMenu mainMenu1 = new MainMenu();

            MenuItem menuItem1 = new MenuItem();
            MenuItem menuItem2 = new MenuItem();

            menuItem1.Text = "File";
            menuItem2.Text = "Edit";
            // Add two MenuItem objects to the MainMenu.
            mainMenu1.MenuItems.Add(menuItem1);
            mainMenu1.MenuItems.Add(menuItem2);

            // Bind the MainMenu to Form1.
            Menu = mainMenu1;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            button1.Hide();
            button1.Show();
        }
    }
}
